package org.example.common.vo;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * @author jzq
 * @date 2022/8/17 15:19
 */
@SuppressWarnings({"all"})
@Data
public class Search {

    private int currentPage;

    private int pageSize;

    //排序规则
    private String sort;

    private String direction;

    private String keyword;

    public void init() {
        this.currentPage = this.currentPage == 0 ? 1 : this.currentPage;
        this.pageSize = this.pageSize == 0 ? 5 : this.pageSize;
        this.sort = StringUtils.isBlank(this.sort) ? "id" : this.sort;
        this.direction = StringUtils.isBlank(this.direction) ? "asc" : this.direction;
    }

}
